<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="headertitle">
<h1>common-mmux.h</h1>  </div>
</div>
<div class="contents">
<a href="common-mmux_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*!@addtogroup common_includes</span>
<a name="l00002"></a>00002 <span class="comment"> * @{</span>
<a name="l00003"></a>00003 <span class="comment"> * @defgroup MMUX-common_h MMUX Functions</span>
<a name="l00004"></a>00004 <span class="comment"> * Commonly used types and defines used by Motor MUX drivers.</span>
<a name="l00005"></a>00005 <span class="comment"> * @{</span>
<a name="l00006"></a>00006 <span class="comment"> */</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="comment">/*</span>
<a name="l00010"></a>00010 <span class="comment"> * $Id: common-mmux.h 133 2013-03-10 15:15:38Z xander $</span>
<a name="l00011"></a>00011 <span class="comment"> */</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="comment">/** \file common-MMUX.h</span>
<a name="l00014"></a>00014 <span class="comment"> * \brief Commonly used types and defines used by Motor MUX drivers.</span>
<a name="l00015"></a>00015 <span class="comment"> *</span>
<a name="l00016"></a>00016 <span class="comment"> * common-MMUX.h provides a number of frequently used types and defines that are useful for writing</span>
<a name="l00017"></a>00017 <span class="comment"> * Motor MUX drivers.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * License: You may use this code as you wish, provided you give credit where its due.</span>
<a name="l00020"></a>00020 <span class="comment"> *</span>
<a name="l00021"></a>00021 <span class="comment"> * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER. </span>
<a name="l00022"></a>00022 <span class="comment"></span>
<a name="l00023"></a>00023 <span class="comment"> *</span>
<a name="l00024"></a>00024 <span class="comment"> * Changelog:</span>
<a name="l00025"></a>00025 <span class="comment"> * - 0.1: Initial release split from common.h</span>
<a name="l00026"></a>00026 <span class="comment"> *</span>
<a name="l00027"></a>00027 <span class="comment"> * \author Xander Soldaat (xander_at_botbench.com)</span>
<a name="l00028"></a>00028 <span class="comment"> * \date 18 January 2011</span>
<a name="l00029"></a>00029 <span class="comment"> * \version 0.1</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#pragma systemFile</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef __MMUX_H__</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define __MMUX_H__</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifndef SPORT</span>
<a name="l00038"></a><a class="code" href="group___m_m_u_x-common__h.html#gabf500b8c69e75f9fad47c3a3e25626c7">00038</a> <span class="preprocessor"></span><span class="preprocessor">#define SPORT(X)  X / 4         </span><span class="comment">/*!&lt; Convert tMUXSensor to sensor port number */</span>
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#ifndef MPORT</span>
<a name="l00042"></a><a class="code" href="group___m_m_u_x-common__h.html#ga9b28381cff35f11a5fd1aff7576117bc">00042</a> <span class="preprocessor"></span><span class="preprocessor">#define MPORT(X)  X % 4         </span><span class="comment">/*!&lt; Convert tMUXSensor to MUX port number */</span>
<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00045"></a>00045 <span class="comment">/*!&lt; Struct to hold MMUX info */</span>
<a name="l00046"></a><a class="code" href="structmmux_data_t.html">00046</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00047"></a><a class="code" href="structmmux_data_t.html#ad86e7ae1ce88f3a7655a02558318afc3">00047</a>   <span class="keywordtype">bool</span> <a class="code" href="structmmux_data_t.html#ad86e7ae1ce88f3a7655a02558318afc3">initialised</a>;     <span class="comment">/*!&lt; Has the MMUX been initialised yet? */</span>
<a name="l00048"></a><a class="code" href="structmmux_data_t.html#af08ed774d78a78624258fa17b718cd2b">00048</a>   <span class="keywordtype">bool</span> runToTarget[4];  <span class="comment">/*!&lt; Indicate whether or not the motor is running to a target */</span>
<a name="l00049"></a><a class="code" href="structmmux_data_t.html#a323674818d85ef4c3430253aa45a0d8e">00049</a>   <span class="keywordtype">long</span> <a class="code" href="group__htmc.html#ga39e0493ce40209f8833cc55adbeed48e">target</a>[4];       <span class="comment">/*!&lt; Target we want the motor to run to */</span>
<a name="l00050"></a><a class="code" href="structmmux_data_t.html#af605cf5944be1527f218146e36f01c7b">00050</a>   byte targetUnit[4];   <span class="comment">/*!&lt; Type of target we&#39;re running to, could be rotation, encoder or seconds */</span>
<a name="l00051"></a><a class="code" href="structmmux_data_t.html#a50271be624f6c46183c5b1c50973ea14">00051</a>   <span class="keywordtype">bool</span> relTarget[4];    <span class="comment">/*!&lt; Whether or not the target is relative to current position */</span>
<a name="l00052"></a><a class="code" href="structmmux_data_t.html#a9063971c953b64e1b32222b9ce5780f6">00052</a>   <span class="keywordtype">bool</span> brake[4];        <span class="comment">/*!&lt; Whether or not to use braking or floating to stop motor */</span>
<a name="l00053"></a><a class="code" href="structmmux_data_t.html#a201498569375a319530e44ca4bc069ff">00053</a>   <span class="keywordtype">bool</span> pidcontrol[4];   <span class="comment">/*!&lt; Use constant speed or just power control */</span>
<a name="l00054"></a><a class="code" href="structmmux_data_t.html#aaf32ec57dafc672cd270aeaceab02bdb">00054</a>   byte ramping[4];      <span class="comment">/*!&lt; Ramp the motors, can be up, down, both */</span>
<a name="l00055"></a>00055 } <a class="code" href="structmmux_data_t.html">mmuxDataT</a>;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment"></span>
<a name="l00058"></a>00058 <span class="comment">/*!&lt; MUXmotor type, one for each permutation</span>
<a name="l00059"></a>00059 <span class="comment"> *</span>
<a name="l00060"></a>00060 <span class="comment"> * - mmotor_S1_1 means motor 1 connected to MMUX attached to sensor port 1</span>
<a name="l00061"></a>00061 <span class="comment"> * - mmotor_S4_2 means motor 2 connedted to MMUX attached to sensor port 4</span>
<a name="l00062"></a>00062 <span class="comment"> */</span>
<a name="l00063"></a><a class="code" href="group___m_m_u_x-common__h.html#ga11217de3dd0a7e4159c3578c1cdbba12">00063</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00064"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12aabb4a3ab7f9b14ff00edd2f377e181bb">00064</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12aabb4a3ab7f9b14ff00edd2f377e181bb">mmotor_S1_1</a> = 0,
<a name="l00065"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12ab0e5af6e8540895adbd0aa1598a8656b">00065</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12ab0e5af6e8540895adbd0aa1598a8656b">mmotor_S1_2</a> = 1,
<a name="l00066"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a1a6efd1925ccf0df8fc68f75ed1d1a6e">00066</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a1a6efd1925ccf0df8fc68f75ed1d1a6e">mmotor_S1_3</a> = 2,
<a name="l00067"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12acd2e66eee7da481131487c1ef18434eb">00067</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12acd2e66eee7da481131487c1ef18434eb">mmotor_S1_4</a> = 3,
<a name="l00068"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a650062bccd14147bc0d88bd1a9d65a19">00068</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a650062bccd14147bc0d88bd1a9d65a19">mmotor_S2_1</a> = 4,
<a name="l00069"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a07df803c9bcf900690f0d113c9b17136">00069</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a07df803c9bcf900690f0d113c9b17136">mmotor_S2_2</a> = 5,
<a name="l00070"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a7eaf2617ce86edf444863330eddf5cd8">00070</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a7eaf2617ce86edf444863330eddf5cd8">mmotor_S2_3</a> = 6,
<a name="l00071"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a89b370a68b377cb64dc86de3ace7c44b">00071</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a89b370a68b377cb64dc86de3ace7c44b">mmotor_S2_4</a> = 7,
<a name="l00072"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a7fa61551c210c0ea2d127ed977504254">00072</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a7fa61551c210c0ea2d127ed977504254">mmotor_S3_1</a> = 8,
<a name="l00073"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12ad6537cec4996b9196e1fc5419ef26ba5">00073</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12ad6537cec4996b9196e1fc5419ef26ba5">mmotor_S3_2</a> = 9,
<a name="l00074"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a1d765aa51059d056ef56b06beb1adb6b">00074</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a1d765aa51059d056ef56b06beb1adb6b">mmotor_S3_3</a> = 10,
<a name="l00075"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a192f76193f1c55e2b642d3df9959d271">00075</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a192f76193f1c55e2b642d3df9959d271">mmotor_S3_4</a> = 11,
<a name="l00076"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a0451085ed390ab89e7a85fed4673c232">00076</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a0451085ed390ab89e7a85fed4673c232">mmotor_S4_1</a> = 12,
<a name="l00077"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a02ae57017ae65a1f201a1e703bd046eb">00077</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a02ae57017ae65a1f201a1e703bd046eb">mmotor_S4_2</a> = 13,
<a name="l00078"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12adb777ca194fbaea493452f2ad81896b9">00078</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12adb777ca194fbaea493452f2ad81896b9">mmotor_S4_3</a> = 14,
<a name="l00079"></a><a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a33f5d4f1256cfa37d28b7b58bcb83a9c">00079</a>   <a class="code" href="group___m_m_u_x-common__h.html#gga11217de3dd0a7e4159c3578c1cdbba12a33f5d4f1256cfa37d28b7b58bcb83a9c">mmotor_S4_4</a> = 15
<a name="l00080"></a>00080 } <a class="code" href="group___m_m_u_x-common__h.html#ga11217de3dd0a7e4159c3578c1cdbba12">tMUXmotor</a>;
<a name="l00081"></a>00081 
<a name="l00082"></a><a class="code" href="group___m_m_u_x-common__h.html#ga048db86417be3a81da734debe91a52db">00082</a> <a class="code" href="structmmux_data_t.html">mmuxDataT</a> <a class="code" href="group___m_m_u_x-common__h.html#ga048db86417be3a81da734debe91a52db">mmuxData</a>[4];  <span class="comment">/*!&lt; Holds all the MMUX info, one for each sensor port */</span>
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 <span class="preprocessor">#endif // __MMUX_H__</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span>
<a name="l00086"></a>00086 <span class="comment">/*</span>
<a name="l00087"></a>00087 <span class="comment"> * $Id: common-mmux.h 133 2013-03-10 15:15:38Z xander $</span>
<a name="l00088"></a>00088 <span class="comment"> */</span>
<a name="l00089"></a>00089 <span class="comment">/* @} */</span>
<a name="l00090"></a>00090 <span class="comment">/* @} */</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:42 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
